﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BT_DoHoa_Nhom13.ShapeLib.FCShapes
{
    public class FCArrowShape : MyDiagramShape
    {
        public const int DISTANCE = 3;
        public FCArrowShape()
        {
            lstShapes = new List<MyShape>();
            lstShapes.Add(new MyLine());
            lstShapes.Add(new MyLine());
            lstShapes.Add(new MyLine());
        }

        public override MyShape Clone()
        {
            return new FCArrowShape();
        }

        public override MyShape CloneByDiagramFactory(DiagramFactorys.MyDiagramFactory factory)
        {
            MyShape newShape = factory.GetArrowShape();
            newShape.Copy(this);
            return newShape;
        }


        public override void ResetChildPoint()
        {

            lstShapes[0].SetStartPoint(startX, startY);
            lstShapes[0].SetEndPoint(endX, endY);

            lstShapes[1].SetStartPoint(endX, endY);
            lstShapes[2].SetStartPoint(endX, endY);

            if (endX > startX)
            {
                lstShapes[1].SetEndPoint(endX - DISTANCE, endY - DISTANCE);
                lstShapes[2].SetEndPoint(endX - DISTANCE, endY + DISTANCE);
            }
            else
            {
                lstShapes[1].SetEndPoint(endX + DISTANCE, endY - DISTANCE);
                lstShapes[2].SetEndPoint(endX + DISTANCE, endY + DISTANCE);
            }
        }

    }
}
